﻿using System;
using fastCSharp;

namespace diantou.web.ajax
{
    /// <summary>
    /// 问题操作
    /// </summary>
    [fastCSharp.code.cSharp.ajax(IsPool = true)]
    class question : userHandle<question>
    {
        /// <summary>
        /// 添加问题
        /// </summary>
        /// <param name="value"></param>
        /// <param name="topicIds"></param>
        /// <param name="isAnonymous"></param>
        /// <param name="onReturn"></param>
        public void Append(diantou.dataAccess.question value, int[] topicIds, bool isAnonymous, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.dataAccess.tcpCall.question.append(value, topicIds, isAnonymous, onReturn);
        }
        /// <summary>
        /// 修改问题标题
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void ReworkTitle(diantou.dataAccess.question value, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            value.ReworkTitleUserId = currentUser.Id;
            diantou.dataAccess.tcpCall.question.reworkTitle(value, onReturn);
        }
        /// <summary>
        /// 修改问题描述
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void ReworkRemark(diantou.dataAccess.question value, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            value.ReworkRemarkUserId = currentUser.Id;
            diantou.dataAccess.tcpCall.question.reworkRemark(value, onReturn);
        }
        /// <summary>
        /// 问题重定向设置
        /// </summary>
        /// <param name="id"></param>
        /// <param name="linkId"></param>
        /// <param name="onReturn"></param>
        public void SetRedirect(int id, int linkId, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.dataAccess.tcpCall.question.setRedirect(id, linkId, currentUser.Id, onReturn);
        }
        /// <summary>
        /// 邀请回答问题
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void Invite(diantou.dataAccess.questionInvite value, Action<fastCSharp.net.returnValue<int>> onReturn)
        {
            value.InviterId = currentUser.Id;
            diantou.dataAccess.tcpCall.questionInvite.invite(value, onReturn);
        }
        /// <summary>
        /// 忽略回答邀请
        /// </summary>
        /// <param name="questionId"></param>
        /// <param name="reason"></param>
        /// <param name="onReturn"></param>
        public void IgnoreInvite(int questionId, diantou.dataAccess.questionInvite.ignoreReasonType reason, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            diantou.dataAccess.tcpCall.questionInvite.ignore(questionId, currentUser.Id, reason, onReturn);
        }
        /// <summary>
        /// 获取问题草稿
        /// </summary>
        /// <returns></returns>
        [fastCSharp.code.cSharp.ajax(IsOnlyPost = false)]
        public diantou.dataModel.questionDraft GetDraft()
        {
            return diantou.dataAccess.tcpCall.questionDraft.get(currentUser.Id);
        }
        /// <summary>
        /// 保存问题草稿
        /// </summary>
        /// <param name="value"></param>
        /// <param name="onReturn"></param>
        public void SaveDraft(diantou.dataAccess.questionDraft value, Action<fastCSharp.net.returnValue> onReturn)
        {
            value.UserId = currentUser.Id;
            diantou.dataAccess.tcpCall.questionDraft.save(value, onReturn);
        }
    }
}
